package com.changgou.goods.dao;

import com.changgou.goods.pojo.Spec;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
import java.util.Map;

public interface SpecMapper extends Mapper<Spec> {
    /**
     * 根据商品分类查询产品规格
     * @param categoryName
     * @return
     */
//    @Select("\n" +
//            "SELECT name , options FROM tb_spec WHERE template_id IN (SELECT template_id FROM tb_category WHERE NAME = \"冰箱\") ORDER BY seq\n" +
//            "\n")
    @Select("SELECT name , options FROM tb_spec WHERE template_id IN (SELECT template_id FROM tb_category WHERE name = #{categoryName}) ORDER BY seq")
    public List<Map> findListByCategoryName(@Param("categoryName") String categoryName);

}
